using System;
using System.Diagnostics;

namespace SpellCenter.UI.FileChoosing
{
    class BackNextCancelControlPM
    {
        private readonly int _pages;
        private int _page;

        public BackNextCancelControlPM(int pages)
        {
            _pages = pages;
        }

        #region Properties

        public string NextText
        {
            get
            {
                Debug.Assert(_page <= _pages && _page >= 0);
                if (_page >= _pages - 1)
                    return "Finish";
                else return "Next >";
            }
        }
        public bool BackEnabled
        {
            get
            {
                Debug.Assert(_page <= _pages && _page >= 0);
                if (_page == 0)
                    return false;
                else return true;
            }
        }
        public bool Finished
        {
            get { return _page == _pages; }
        }

        public int PageNumber
        {
            get { return _page; }
        }

        #endregion

        public void ToPrevPage()
        {
            if(_page > 0)
                _page--;
        }

        public void ToNextPage()
        {
            if (_page < _pages)
                _page++;
        }

        public void Reset()
        {
            _page = 0;
        }
    }

}
